#!/usr/bin/env python
#
#    Copyright (C) 2012 Gonzalo Bonigo <gonzalobonigo@gmail.com>
#
#   This program is free software: you can redistribute it and/or modify
#   it under the terms of the GNU General Public License as published by
#   the Free Software Foundation, either version 3 of the License, or
#   (at your option) any later version.
#
#   This program is distributed in the hope that it will be useful,
#   but WITHOUT ANY WARRANTY; without even the implied warranty of
#   MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
#   GNU General Public License for more details.
#
#   You should have received a copy of the GNU General Public License
#   along with this program.  If not, see http://www.gnu.org/licenses/
#


"""Este es un modulo ejecutable que permite sincronizar sistemas."""


import os.path
import time
import sys
import os

from daddyparsers import *
import lts


if __name__ == '__main__':
    # Parseo los argumentos de entrada.
    parsed_args = parse(sys.argv[1:],2,3)
    system = parsed_args["system"]
    sync_set = parsed_args["sync_set"]
    graphic = parsed_args["graphic"]
    if len(system) == 1:
        print "\nIt needs at least tow systems!\n"
        sys.exit(0)
    result = system.pop(0)
    while system:
        result = result.sync(system.pop(0), sync_set)
    lts.to_file(result)
    if graphic:
        lts.graph(result.name)
